;; generic/iterate.scm - (c) rohan drape, 2000-2005

;; The generic iteration construct.  `z' is a scalar or data
;; structure.  `p' may be a procedure of zero or one argument.  Apply
;; `p' `z' times, else apply `p' to the elements of `z'.  Where `z' is
;; an integer these are the numbers from zero to one less than `z'.

(define-generic iter)
(define-method (iter (z <integer>) (p <procedure>)) (integer-iterate z p))
(define-method (iter (z <list>) (p <procedure>))    (iterate z p))
(define-method (iter (z <vector>) (p <procedure>))  (vector-iterate z p))
(define-method (iter (z <string>) (p <procedure>))  (string-iterate z p))
